package com.dean.batch.entity;

import com.dean.batch.service.DeanBatchJobService;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName DeanBatchJob
 * @Description dean batch job
 * @Author dean
 * @Date 2021/12/16 12:24
 */
public class SysBatchJob implements BaseEntity{
    private final String JOB_ID = "JOB_ID";
    private final String JOB_NAME = "JOB_NAME";
    private final String JOB_DESC = "JOB_DESC";
    private final String JOB_STATUS = "JOB_STATUS";
    private final String JOB_CLASS = "JOB_CLASS";

    private String jobId;
    private String jobName;
    private String jobDesc;
    private String jobStatus;
    private String jobClass;

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getJobDesc() {
        return jobDesc;
    }

    public void setJobDesc(String jobDesc) {
        this.jobDesc = jobDesc;
    }

    public String getJobStatus() {
        return jobStatus;
    }

    public void setJobStatus(String jobStatus) {
        this.jobStatus = jobStatus;
    }

    public String getJobClass() {
        return jobClass;
    }

    public void setJobClass(String jobClass) {
        this.jobClass = jobClass;
    }

    /**
     * 设置指定的字段信息
     * @param fieldName
     * @param fieldValue
     */
    @Override
    public void set(String fieldName,Object fieldValue) {
        fieldName = fieldName.toUpperCase();
        String value = fieldValue == null ? null : String.valueOf(fieldValue);
        switch (fieldName) {
            case JOB_ID:
                setJobId(value);
                break;
            case JOB_NAME:
                setJobName(value);
                break;
            case JOB_DESC:
                setJobDesc(value);
                break;
            case JOB_STATUS:
                setJobStatus(value);
                break;
            case JOB_CLASS:
                setJobClass(value);
                break;
            default:
                break;
        }
    }
    @Override
    public String toString() {
        return "SysBatchJob{" +
                "jobId='" + jobId + '\'' +
                ", jobName='" + jobName + '\'' +
                ", jobDesc='" + jobDesc + '\'' +
                ", jobStatus='" + jobStatus + '\'' +
                ", jobClass='" + jobClass + '\'' +
                '}';
    }

    public static void main(String[] args) {
        SysBatchJob entity = new SysBatchJob();
        Map<String,Object> objectMap = new HashMap<>();
        objectMap.put("JOB_ID","test");
        entity.set(objectMap);
        System.out.println(entity);
    }
}
